#ifndef __STDTCP_H__
#define __STDTCP_H__

#include <stdbool.h>
#include <stddef.h>

// 服务器端
struct StdTcpServer;
typedef struct StdTcpServer TcpS;
// 监听
TcpS* TcpServerInit(const char *ip, unsigned short port);
// 接收
int TcpServerAccept(TcpS * s);
// 读 写
bool TcpServerSend(int clientSock, void *p, size_t size);
bool TcpServerRecv(int clientSock, void *p, size_t size);
void ClearTcpServer(TcpS * s);


// 客户端
struct StdTcpClient;
typedef struct StdTcpClient TcpC;
TcpC * TcpClientInit(const char *ServerIp, unsigned short ServerPort);
// 读 写
bool TcpClientSend(TcpC * c, void * p, size_t size);
bool TcpClientRecv(TcpC * c, void * p, size_t size);
void ClearTcpClient(TcpC * c);



#endif